package com.lagou.homework1;

/**
 * 编程实现Coder类的封装
 */
public class Coder {
    //私有化成员变量
    private String name;
    private int id;
    private int salary;

    //自定义无参构造和有参构造

    public Coder() {
    }

    public Coder(String name, int id, int salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }
    //提供公有的get和set方法

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    //自定义成员方法
    public void work() {
        System.out.println("工号为：" + getId() + "基本工资为：" + getSalary() + "的程序员" + getName() + "正在努力的写着代码。。。。。");
    }
}
